package uuengine.util;

public class Location {
	private int x=0;
	private int y=0;
	
	public Location(int x,int y)
	{
		setPosition( x, y);
	}
	
	public Location(Location location )
	{
		setPosition( location);
	}
	
	
	public void setPosition(Location position)
	{
		 setPosition(position.getX(),position.getY());
	}
	
	
	public Location add(int x,int y)
	{
		this.x+=x;
		this.y+=y;
		return this;
	}
	public Location add(Location position)
	{
		return add(position.getX(),position.getY());
	}
	
	
	public Location reduce(Location position)
	{
		return add(-position.getX(),-position.getY());
	}
	
	public void setPosition(int x,int y)
	{
		this.x=x;
		this.y=y;
	}
	
	
	public int getX()
	{
		return x;
	}
	
	public int getY()
	{
		return y;
	}
	
	public boolean equals(Object obj)
	{
		if(obj instanceof Location)
		{
			Location currLoc=(Location) obj;
			if(currLoc.getX()==getX()&&currLoc.getY()==getY())
			{
				return true;
			}
		}
		return false;
	}
}
